{% include "op_header.html" %}
<script type="text/javascript" charset="utf-8">
    window.UEDITOR_HOME_URL = "/static/js/ueditor/";
</script>

<script type="text/javascript" charset="utf-8" src="/static/js/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/js/ueditor/editor_all_min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/js/ueditor/themes/default/ueditor.css"/>
            <div class="container-fluid">
                <div class="row-fluid">
                    <div class="span12">
                        <div class="alert">
                             <button type="button" class="close" data-dismiss="alert">×</button>
                            <h4>
                                提示!
                            </h4> <strong>注意!</strong> 如选项中无自己所需要的选项，请联系相关人员后台添加.
                        </div>
                    </div>
                </div>
            </div>
			<form class="form-horizontal" method="post">
				<div class="control-group">
					<label class="control-label" for="inputEmail">资产编号</label>
					<div class="controls">
						<input id="id_Server_Asset_number" type="text" value="{{ edit_id.Server_Asset_number }}" name="Server_Asset_number" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputEmail">网卡1</label>
					<div class="controls">
						<input id="id_Server_eth1" type="text"value="{{ edit_id.Server_eth1 }}"  name="Server_eth1" maxlength="64" />
					</div>
				</div>
                <div class="control-group">
					<label class="control-label" for="inputEmail">网卡2</label>
					<div class="controls">
						<input id="id_Server_eth2" type="text" value="{{ edit_id.Server_eth2 }}"  name="Server_eth2" maxlength="64" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputEmail">远控卡ip</label>
					<div class="controls">
						<input id="id_Server_Remote_control_card" type="text" value="{{ edit_id.Server_Remote_control_card }}" name="Server_Remote_control_card" maxlength="64" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputEmail">所属机房</label>
                    <div class="controls">
{#                        {{ uf.Server_engine_room }}#}

                    <select id="id_Server_engine_room" name="Server_engine_room">
                        {% for i in server_name %}
                            <option {% ifequal i.id edit_id.Server_engine_room_id %} selected="selected"{% endifequal%} value="{{ i.id }}">{{i.engine_room_name}}</option>
                        {% endfor %}
                    </select>
                    </div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputEmail">cacti url</label>
					<div class="controls">
						<input id="id_Server_cacti" type="text" value="{{ edit_id.Server_cacti }}" name="Server_cacti" maxlength="128" />
					</div>
				</div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">内存/硬盘/cpu</label>
                    <div class="controls">
                        <input id="id_Server_Memory" type="text" value="{{ edit_id.Server_Memory }}" name="Server_Memory" maxlength="256" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">业务</label>
                    <div class="controls">
                        <input id="id_Server_Business" type="text" value="{{ edit_id.Server_Business }}" name="Server_Business" maxlength="256" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="id_Server_Model">服务器型号</label>
                    <div class="controls">
                        <select id="id_Server_Model" name="Server_Model">
{#                        {{ uf.Server_Model }}#}
                            {% for i in server_name_id %}
                                <option {% ifequal i.id edit_id.Server_Model_id %} selected="selected"{% endifequal%} value="{{ i.id }}">{{i.Poster_Model_name}}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="id_Server_number">服务编码</label>
                    <div class="controls">
                        <input id="id_Server_number" type="text" value="{{ edit_id.Server_number }}" name="Server_number" maxlength="32" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="id_Server_number">快速服务代码</label>
                    <div class="controls">
                        <input id="id_Server_number_code" type="text" value="{{ edit_id.Server_number_code }}" name="Server_number_code" maxlength="32" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="id_Server_number">机柜</label>
                    <div class="controls">
{#                        {{ uf.Server_number_Location }}#}
                        <select id="id_Server_number_Location" name="Server_number_Location">
                            {% for i in Poster_Source_id %}
                                <option {% ifequal i.id edit_id.Server_number_Location_id %} selected="selected"{% endifequal%} value="{{ i.id }}">{{i.name}}</option>
                            {% endfor %}
                        </select>
{#                        <a id="modal-649168" href="#modal-container-449168" role="button" class="btn" data-toggle="modal">添加机柜</a>#}

                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="id_Server_number">机器位置</label>
                    <div class="controls">
                        <input id="id_Server_cabinet_id" type="text" value="{{ edit_id.Server_cabinet_id }}" name="Server_cabinet_id" maxlength="32" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="id_Server_number">所属业务</label>
                    <div class="controls" style="height: 80px">
                    <select id="id_Business" name="Project" multiple="multiple">
{#                    {% for list_id in server_id %}#}
{#                        <option value="{{ list_id.id }}" selected="selected" >{{ list_id }}</option>#}
                        {% for i in Project  %}
                            {% for list_id in server_id %}
                                <option {% ifequal i.id list_id.id %} selected="selected" {% endifequal%} value="{{ i.id }}">{{i}}</option>
                            {% endfor %}
                        {% endfor %}
{#                    {% endfor %}#}
                    </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">备注</label>
                    <div class="controls">
{#                        <input id="id_Server_number_Remark" type="text" name="Server_number_Remark" maxlength="256" />#}
                        <textarea id="editor" name="Server_number_Remark"  style="width:600px;height:500px;">{{ edit_id.Server_number_Remark }}</textarea>
                    </div>
                </div>
{#                {{ uf.as_p }}#}
                <div class="control-group">
                    <div class="controls">
                        <button type="submit" class="btn" >提交</button>
                    </div>
                </div>
			</form>
		</div>
	</div>
</div>

{#添加机房#}
<div id="modal-container-449168" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<form method="post" id="form-add-modal" onsubmit="return false;">
            <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">
                    添加机房
                </h3>
            </div>
            <div class="modal-body">
                <p>
                    显示信息
                    <input type="text" name="engine_room_name" id="addsv" value="" />
                </p>
            </div>
            <div class="modal-footer">
                 <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button> <button class="btn btn-primary" onclick="addserver();">保存设置</button>
            </div>
        </div>
    </div>
</form>
</div>
<script>
    function addserver() {
        newserver_name = $("#addsv").val();
       /* $.post("/server/add_room", $("#form-add-modal").serialize(), function(data){
            if (data && data.code == 1){
                alert('2');
            } else{
                alert('5');
            }
        }, 'json');*/
        $.ajax({
           type: "POST",
           url: "/server/add_room",
           data: $("#form-add-modal").serialize(),
           dataType:'json',
           complete: function(msg){
                var data = eval('('+msg.responseText+')');
                if (data && data.code == 1){
{#                    $("#id_Server_engine_room").app;#}
                    $("#modal-container-449168").modal('hide');
                } else{
                    alert('添加失败');
                }
           }
        });
    }
</script>
{#服务器型号#}

<form method="post" action="">
<div id="modal-container-549168" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">
                    添加服务器型号
                </h3>
            </div>
            <div class="modal-body">
                <p>
                    显示信息
                </p>
            </div>
            <div class="modal-footer">
                 <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button> <button class="btn btn-primary">保存设置</button>
            </div>
        </div>
    </div>
</div>
</form>

{#机柜#}

<form method="post">
<div id="modal-container-549168" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">
                    添加机柜
                </h3>
            </div>
            <div class="modal-body">
                <p>
                    显示信息
                </p>
            </div>
            <div class="modal-footer">
                 <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button> <button class="btn btn-primary">保存设置</button>
            </div>
        </div>
    </div>
</div>
</form>

<script type="text/javascript">
    var ue=new UE.ui.Editor();
    ue.render('editor');
    ue.addListener("selectionchange",function(){
        var state = ue.queryCommandState("source");
        var btndiv = document.getElementById("btns");
        if(btndiv){
            if(state){
                btndiv.style.display = "none";
            }else{
                btndiv.style.display = "";
            }
        }

    });
    function getContent(){
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(ue.getContent());
        alert(arr.join("\n"));
    }
    function getPlainTxt(){
        var arr = [];
        arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
        arr.push("内容为：");
        arr.push(ue.getPlainTxt());
        alert(arr.join('\n'))
    }
    function setContent(){
        var arr = [];
        arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
        ue.setContent('欢迎使用ueditor');
        alert(arr.join("\n"));
    }

    function getText(){
        //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
        var range = ue.selection.getRange();
        range.select();
        var txt = ue.selection.getText();
        alert(txt)
    }

    function testueditor(){
    	mycontent=ue.getContentTxt();
    	alert(mycontent);
    }

    function insertueditor(){
    	ue.execCommand('insertHtml',"自定义插件，我的名片	");
    }

    function getContentTxt(){
        var arr = [];
        arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
        arr.push("编辑器的纯文本内容为：");
        arr.push(ue.getContentTxt());
        alert(arr.join("\n"));
    }
    function hasContent(){
        var arr = [];
        arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
        arr.push("判断结果为：");
        arr.push(ue.hasContents());
        alert(arr.join("\n"));
    }
    function setFocus(){
        ue.focus();

    }
    function deleteEditor(){
        var div = document.getElementById('allbtn');
        var btns = baidu.editor.dom.domUtils.getElementsByTagName(div,"a");
        for(var i=0,btn;btn=btns[i++];){
		    btn.style.cssText = "color:#ccc;text-decoration:none;cursor:default";
            btn.onclick = function(){
                return false;
            };
        }
        ue.destroy();
    }
	function setEnabled(){
	    var div = document.getElementById('allbtn');
        var btns = baidu.editor.dom.domUtils.getElementsByTagName(div,"a");
        for(var i=0,btn;btn=btns[i++];){
			btn.style.cssText = "color:#3E3E3E;text-decoration:none;cursor:pointer";
        }
	    ue.setEnabled();
	}
	function setDisable(){
	    var div = document.getElementById('allbtn');
        var btns = baidu.editor.dom.domUtils.getElementsByTagName(div,"a");
        for(var i=0,btn;btn=btns[i++];){
		    if(btn.innerHTML != "可以编辑"){
				btn.style.cssText = "color:#ccc;text-decoration:none;cursor:default";
			}
        }
	    ue.setDisabled("fullscreen");
	}

</script>

<!-- baidu ueditor end -->



{% include "bottom.html" %}